<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <h1>{{msg}}</h1>
        <vue3-com></vue3-com>
        <button @click="handleClick">点击</button>
    </div>
</body>

</html>
<script src="https://unpkg.com/vue@next"></script>
<script>
    console.log(Vue)

    //创建一个应用

    // Vue.createApp(选项)

    let app = Vue.createApp({
        data() {
            return {
                msg: "vue3"
            }
        },
        methods: {
            handleClick() {
                this.msg = 'vue3真好玩'
            }
        }
    })

    //创建一个组件
    app.component("vue3-com", {
        template: "<h1>{{msg}}</h1>",
        data() {
            return {
                msg: "vue3的组件"
            }
        }
    })

    //挂载

    app.mount('#app')
</script>